<template>
  <div id="app-container" class="responsive-container">
    <div class="nav-bar">
      <img src="../assets/home.png" class="home-icon" alt="首页" @click="goToAssistant" />
      <div class="header-actions">
          <img src="../assets/xcx1.png" alt="小程序" class="icon-image header-icon" style="width: 30px !important; height: 30px !important; display: block !important;" />
          <div class="header-divider"></div>
          <img src="../assets/sxq1.png" alt="刷新器" class="icon-image header-icon" style="width: 20px !important; height: 20px !important; display: block !important;" />
      </div>
    </div>

    <div class="invoice-container">
      <div class="title">发票信息</div>
      <p class="subtitle">
        以下信息仅为发票二维码所含信息，并不代表查验发票真伪的结果。
      </p>

      <div class="info-list">
        <div class="info-item">
          <div class="info-row">
            <span class="label">发票代码</span>
            <span class="value">011002100411</span>
          </div>
        </div>
        <div class="info-item">
          <div class="info-row">
            <span class="label">发票号码</span>
            <span class="value">62882941</span>
          </div>
        </div>
        <div class="info-item">
          <div class="info-row">
            <span class="label">合计金额</span>
            <span class="value">¥25408.02(不含税)</span>
          </div>
        </div>
        <div class="info-item">
          <div class="info-row">
            <span class="label">开票日期</span>
            <span class="value">2022.05.31</span>
          </div>
        </div>
        <div class="info-item">
          <div class="info-row">
            <span class="label">发票校验码</span>
            <span class="value">239970</span>
          </div>
        </div>
      </div>
    </div>
    
    <div class="footer">
      <p class="footer-note">
        如需查验发票真伪，请通过税务机关提供的官方渠道进行查验。
      </p>
      <div class="divider"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'InvoicePage',
  methods: {
    goToAssistant() {
      this.$router.push('/assistant');
    }
  }
}
</script>

<style scoped>
/* 使用通用的字体，模拟 iOS 风格 */
body, #app-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  margin: 0;
  padding: 0;
  background-color: #ffffff;
  color: #1c1c1e;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow-wrap: break-word;
}

#app-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100%;
  box-sizing: border-box;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.status-icons {
  display: flex;
  align-items: center;
}
.status-icons .signal, .status-icons .battery {
  /* margin-left: 8px; */
  font-weight: 600;
}

/* 模拟导航栏 */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.nav-bar .home-icon {
  width: clamp(24px, 7vw, 28px);
  height: clamp(24px, 7vw, 28px);
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.nav-bar .home-icon:hover {
  transform: scale(1.1);
}

.header-icon {
  width: clamp(18px, 5vw, 24px) !important;
  height: clamp(18px, 5vw, 24px) !important;
  display: block !important;
  object-fit: contain;
  margin: 0;
  padding: 0;
}

.actions span {
  font-size: clamp(18px, 6vw, 24px);
  margin-left: 15px;
  font-weight: bold;
}

/* 主内容区 */
.invoice-container {
  padding: 10px 20px;
  text-align: center;
  flex-grow: 1;
  width: 100%;
  box-sizing: border-box;
  max-width: 600px;
  margin: 0 auto;
}

.title {
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 550;
  margin-top: clamp(15px, 4vh, 25px);
  margin-bottom: clamp(10px, 3vh, 20px);
  color: #000;
  letter-spacing: 1px;
}

.header-actions {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  padding: clamp(2px, 1vw, 5px) clamp(8px, 2.5vw, 12px);
  border-radius: 50px;
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  gap: clamp(6px, 2vw, 10px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-divider {
  width: 1px;
  height: clamp(16px, 5vw, 20px);
  background-color: rgba(0, 0, 0, 0.1);
}

.header-actions .header-icon {
  width: clamp(16px, 5vw, 24px);
  height: clamp(16px, 5vw, 24px);
  margin: 0;
  padding: 0;
  object-fit: contain;
}

.header-actions .gray-circle {
  position: absolute;
  top: -5px;
  right: -5px;
  width: clamp(8px, 2vw, 12px);
  height: clamp(8px, 2vw, 12px);
  background-color: #cccccc;
  border-radius: 50%;
  z-index: 1;
}

.subtitle {
  width: 100%;
  font-size: clamp(13px, 4vw, 15px);
  color: #000000;
  margin-bottom: clamp(20px, 5vh, 30px);
  line-height: 1.5;
  padding: 0 clamp(10px, 3vw, 20px);
  letter-spacing: 0.5px;
  box-sizing: border-box;
}

.info-list {
  text-align: left;
  width: 100%;
  padding: 0 clamp(10px, 3vw, 20px);
  box-sizing: border-box;
}

.info-item {
  /* padding: clamp(8px, 2vh, 12px) 0; */
  /* margin-bottom: clamp(5px, 1vh, 10px); */
  font-size: clamp(14px, 4vw, 16px);
  /* border-bottom: 1px solid rgba(240, 240, 240, 0.5); */
  transition: all 0.3s ease;
}

.info-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: clamp(5px, 1.5vh, 10px) 0;
}



.label {
  color: #8a8a8e;
  font-size: clamp(14px, 4vw, 16px);
  width: 40%;
  text-align: left;
  padding-right: 10px;
  box-sizing: border-box;
}

.value {
  color: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-weight: 400;
  width: 60%;
  text-align: left;
  word-break: break-word;
  font-size: clamp(14px, 4vw, 16px);
}

@media screen and (max-width: 320px) {
  .info-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .label, .value {
    width: 100%;
    padding: 3px 0;
  }
}

/* 页脚 */
.footer {
  padding: clamp(15px, 4vh, 25px) 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  margin-top: auto;
}

.footer-note {
  font-size: clamp(12px, 3.5vw, 14px);
  color: #b0b0b0;
  line-height: 1.5;
  padding: 0 clamp(20px, 5vw, 40px);
  margin-bottom: clamp(15px, 4vh, 25px);
  letter-spacing: 0.5px;
  max-width: 600px;
}

.divider {
  width: clamp(30%, 120px, 40%);
  height: 5px;
  background-color: #e0e0e0;
  border-radius: 3px;
}

/* 添加更多媒体查询以适配不同设备 */
.responsive-container {
  width: 100%;
  transition: all 0.3s ease;
}

@media screen and (min-width: 768px) {
  #app-container {
    max-width: 600px;
    padding: 0 20px;
  }
  
  .invoice-container {
    padding: 20px 30px;
  }
}

@media screen and (min-width: 992px) {
  #app-container {
    max-width: 700px;
  }
}

@media screen and (min-width: 1200px) {
  #app-container {
    max-width: 800px;
  }
}

@media screen and (max-height: 600px) {
  .title {
    margin-top: 10px;
    margin-bottom: 10px;
  }
  
  .subtitle {
    margin-bottom: 15px;
  }
  
  .info-item {
    padding: 5px 0;
    margin-bottom: 3px;
  }
  
  .footer {
    padding: 10px 0;
  }
  
  .footer-note {
    margin-bottom: 10px;
  }
}

/* 适配横屏模式 */
@media screen and (orientation: landscape) and (max-height: 500px) {
  .nav-bar {
    padding: 5px 15px;
  }
  
  .title {
    margin-top: 5px;
    margin-bottom: 5px;
  }
  
  .subtitle {
    margin-bottom: 10px;
  }
  
  .info-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  
  .info-item {
    width: 48%;
  }
}
</style>